package demo;

public class Test {
    public static void pop()throws NegativeArraySizeException{
        int[]arr=new int[-3];//令数组元素个数为-3使其抛出异常
    }
    public static void main(String[] args) {
        try {
            pop();
        }catch(NegativeArraySizeException e){
            System.out.println("pop()方法抛出的异常");
        }
    }
}
